<%@ page import="java.text.NumberFormat" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="com.nus.beans.User" %>
<%@ page import="java.util.List" %>
<%@ page import="com.nus.beans.UserType" %>
<%@ page import="com.nus.beans.UserSubType" %>
<%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 9/21/12
  Time: 12:10 AM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head><title>Create User</title></head>
<body>
Create User
<%
String errorMessage = (String) request.getAttribute("ERROR_MESSAGE");

%>
<table>
    <form method="post" action="createUser.do">
    <tr>
        <td>Login Name:</td>
        <td><input type="text" name="loginName" maxlength="20"/></td>
    </tr>
    <tr>
        <td>Password:</td>
        <td><input type="password" name="password1"  maxlength="20"/></td>
    </tr>
    <tr>
        <td>Verify Password:</td>
        <td><input type="password" name="password2"  maxlength="20"/></td>
    </tr>

    <tr>
        <td>User Type:</td>
        <td> <select name="userType">
            <%UserType[] userTypes = UserType.values();
                    for (UserType userType : userTypes) {%>
                    <option value="<%=userType.toString()%>"><%=userType.toString()%>
                    </option>
                    <%}%>
                </select>
        </td>
    </tr>
    <tr>
        <td>Developer Sub Type:</td>
        <td> <select name="userSubType">
            <%UserSubType[] userSubTypes = UserSubType.values();
                    for (UserSubType userSubType : userSubTypes) {%>
                    <option value="<%=userSubType.toString()%>"><%=userSubType.toString()%>
                    </option>
                    <%}%>
                </select>
        </td>
    </tr>
    <tr>
        <td>First Name:</td>
        <td><input type="text" name="firstName" maxlength="255"/></td>
    </tr>
    <tr>
        <td>Family Name:</td>
        <td><input type="text" name="familyName" maxlength="255"/></td>
    </tr>
    <tr>
        <td>Date Of Birth:</td>
        <td><select name="yearFrom">
                <%for (int i = 1950; i < 2100; i++) {%>
                <option value="<%=i%>"><%=i%>
                </option>
                <%}%>
            </select>
                <select name="monthFrom">
                    <%for (int j = 1; j < 13; j++) {%>
                    <option value="<%=j%>"><%=j%>
                    </option>
                    <%}%>
                </select>
                <select name="dayFrom">
                    <%for (int k = 1; k < 32; k++) {%>
                    <option value="<%=k%>"><%=k%>
                    </option>
                    <%}%>
                </select>
            </td>
    </tr>
    <tr>
        <td>Address:</td>
        <td><input type="text" name="address1" maxlength="255"/></td>
    </tr>
    <tr>
        <td>Phone Number:</td>
        <td><input type="text" name="phoneNo" maxlength="10"/></td>
    </tr>

    <tr>
        <td>Salary</td>
        <td><input type="text" name="Salary" maxlength="8"/></td>
    </tr>
    <tr>
        <td>Leave Available</td>
        <td><input type="text" name="leaves" maxlength="2"/></td>
    </tr>

        <tr>
            <td colspan="2">
                <% if(errorMessage != null){ %>
                    <%=errorMessage %>
                <% } %>
            </td>
        </tr>
        <tr><td><input type="submit" value="Create"/></td>
            <td><a href="viewHome.do">Home</a></td>
        </tr>
    </form>
</table>

</body>
</html>